package br.pucrio.inf.lac.konoha.hyuga.command;

import java.util.HashMap;
import java.util.Map;

import br.pucrio.inf.lac.konoha.hyuga.core.DDSLink;
import br.pucrio.inf.lac.konoha.hyuga.core.HyugaService;

public class WebPartitionCommand extends Command {

    private HyugaService hyuga;

    public WebPartitionCommand(String commandSTR, HyugaService hyuga) {
        super(commandSTR);

        this.hyuga = hyuga;
    }

    @Override
    public void execute() {
        HashMap<String, Object> partitionsMap = new HashMap<String, Object>();
        partitionsMap.put("operation", "add_partitions");
        partitionsMap.put("longitude", hyuga.getLongitudeSegments().getSegments());
        partitionsMap.put("latitude", hyuga.getLatitudeSegments().getSegments());

        DDSLink.getInstance().publishOut(partitionsMap);
    }

}
